home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / c_course.zip / FILEWRIT.C < prev    next >
Text File  |  1989-12-30  |  458b  |  17 lines

  1. /*    FILEWRIT.C   strcopy()  fopen()  fprintf()   also called FORMOUT.C */
  2. #include "stdio.h"
  3. main()
  4. {
  5. FILE *fp;
  6. char stuff[25];
  7. int index;
  8.  
  9.    fp = fopen("TENLINES.TXT","w");   /* open for writing */
  10.    strcpy(stuff,"This is an example line.");
  11.  
  12.    for (index = 1;index <= 10;index++)
  13.       fprintf(fp,"%s  Line number %d\n",stuff,index);
  14.  
  15.    fclose(fp);    /* close the file before ending program */
  16. }
  17.